package com.yuzhi.master.drainEvents.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuzhi.common.annotation.DataColumn;
import com.yuzhi.common.annotation.DataPermission;
import com.yuzhi.common.core.mapper.BaseMapperPlus;
import com.yuzhi.master.drainEvents.domain.bo.DrainEvents;
import com.yuzhi.master.drainEvents.domain.request.DrainEventsReq;
import com.yuzhi.master.drainEvents.domain.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 事件表Mapper
 *
 * @Author mr.lcc
 * @Data 2025/7/24 12:37
 */
@Mapper
public interface DrainEventsMapper extends BaseMapperPlus<DrainEventsMapper, DrainEvents, DrainEventsVo> {

    @DataPermission({
            @DataColumn(value = "de.admacd")
    })
    Page<DrainEventsVo> selectPageList(@Param("page") Page<DrainEventsVo> page,@Param(Constants.WRAPPER) Wrapper<DrainEvents> queryWrapper);

    @DataPermission({
            @DataColumn(value = "de.admacd")
    })
    Page<DrainEventsVo> selectPageList2(@Param("page") Page<DrainEventsVo> page,@Param(Constants.WRAPPER) Wrapper<DrainEvents> queryWrapper);



    /**
     * 查询单个
     *
     * @param id 查询参数
     * @return 单个对象
     */
    DrainEventsVo selectOneQuery(@Param("id") String id);

    /**
     * 获取数据字典
     *
     * @return 数据字典
     */
    @Select("select DISTINCT dd.dict_label as dictLabel,dd.dict_value as dictValue from psbiz.sys_dict_data dd WHERE dict_type=#{dataDictionary} and dd.deleted = 0")
    List<DataDictionary> getDataDictionary(@Param("dataDictionary") String dataDictionary);

    /**
     * 根据设备类型获取设备类型
     *
     * @param remark 设备类型
     * @return 设备类型
     */
    List<DictItemDevice> getDeviceTypeByRemark(@Param("remark") String remark);

    /**
     * 根据id获取详情
     *
     * @param id 设备类型
     * @return 设备类型
     */
    DrainEventsVo getOneAdd(@Param("id") String id);

    /**
     * 移动端我的工单任务列表
     * @param
     * @return 最新一条
     */
    List<DrainEventsResultVo> queryAppTodoEvents(String userId,String eventsStatus);

    /**
     * 工单统计
     */
    List<DrainWorkOrderStatisticVo> queryAppWorkOrderStatistics(@Param("req") DrainEventsReq req);

    /**
     * 人工处理工单统计
     */
    List<DrainWorkOrderHandlingVo> queryAppWorkOrderHandlingStatistics(@Param("req") DrainEventsReq req);
}
